<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
	    <script type="text/javascript" src="../../js/html5/html5.min.js"></script>
	    <script type="text/javascript" src="../../js/respond/respond.min.js"></script>
	    <script type="text/javascript" src="../../js/PIE/2.0/PIE_IE678.js"></script>
	 <![endif]-->
<link href="../../css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="../../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<%--<link href="<c:url value="/css/Hui-iconfont/1.0.1/iconfont.css"/> " rel="stylesheet" type="text/css" />--%>
<link href="../../css/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<title>系统管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理<span class="c-gray en">&gt;</span> 短信模板<a class="btn btn-success radius r mr-20" style="line-height: 1.6em; margin-top: 3px" href="<c:url value ="/admin/sms/list"/>" title="返回"><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l"> <a href="javascript:;" onclick="sms_add('添加短信模板','<c:url value="/admin/sms/toAdd"/> ','800','700')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加短信模板</a>
			</span>
		</div>
		<table class="table table-border table-bordered table-hover table-bg table-sort" id="content">
			<thead>
				<tr class="text-c">
					<th>创建时间</th>
					<th>模板类型</th>
					<th>模板内容</th>
					<th>激活状态</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${viewData}" var="sms">
					<tr class="text-c">
						<td><fmt:formatDate value="${sms.createTime }" pattern="yyyy-MM-dd HH:mm:ss" /></td>
						<td><c:if test="${sms.type=='A' }">验证码</c:if> <c:if test="${sms.type=='B' }">通知消息</c:if></td>
						<td>${sms.msg }</td>
						<td><c:if test="${sms.status }">已激活</c:if> <c:if test="${sms.status ==false }">未激活</c:if></td>
						<td><a href="javascript:;" onclick="activate(this,'${sms.id}','${sms.type}')">激活</a>&nbsp;<a href="javascript:;" onclick="sms_edit('修改短信模板','<c:url value="/admin/sms/toEdit?id=${sms.id }"/>','800','700')">编辑</a>&nbsp;<a href="<c:url value="/admin/sms/detail?id=${sms.id }"/>">查看详情</a></td>
					</tr>
				</c:forEach>
			</thead>
			<tbody>
			</tbody>
		</table>
	</div>
	<script type="text/javascript" src="../../js/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="../../js/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="../../js/h-ui/2.3/H-ui.js"></script>
	<script type="text/javascript" src="../../js/h-ui/2.3/H-ui.admin.js"></script>
	<script type="text/javascript">
		function sms_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}
		function sms_edit(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		/*延期项目*/
		function activate(obj, id, type) {
			layer.confirm('是否激活该短信模板？', {
				btn : [ '是', '取消' ],
				shade : false
			}, function() {
				$.ajax({
					type : "post",
					dataType : "json",
					data : {
						id : id,
						type : type
					},
					url : "<c:url value="/admin/sms/activate"/>",
					success : function(data, textStatus) {
						layer.msg(data.msg, {
							icon : 6,
							time : 1000
						}, function() {
							location.reload(true);
						});
					},
					error : function(data) {
						layer.msg(data.msg, {
							icon : 5,
							time : 1000
						});
					}
				});
			});
		}
	</script>
</body>
</html>